Technotes
TextEdit EOL Ambiguity
Revised by: March 1988
Written by: Rick Blair May 1987
TESetSelect may be used to position the insertion point at the end of a
line. There is an ambiguity, though; should the insertion point appear at the
end of the preceding line or the start of the following one? It is possible to
determine what will happen, as you are about to see.
There is an internal flag used by TextEdit to determine where the insertion
point at the end of a line appears. This flag is part of the clikStuff
field in the TERec. It is there mainly for the use of
TEClick, but it is also used by TESetSelect (although it
defaults to the right side of the previous line).
The following code can be used to force the insertion point to appear at the
left of the following line when it is positioned at the end of a line; in MPW
Pascal:
TEDeactivate(tH);
tH^^.clikStuff := 255; {position caret on left}
TESetSelect(eolcharpos, eolcharpos, tH); {ambiguous point}
TEActivate(tH);
In MPW C:
TEDeactivate(tH);
(**tH).clikStuff = 255; /*position caret on left*/
TESetSelect(eolcharpos, eolcharpos, tH); /*ambiguous point*/
TEActivate(tH);
If you want to ensure that the caret is on the right side (to which it normally
defaults) then substitute a zero for the 255.
Further Reference:
Technotes
Previous Technote | Contents | Next Technote